package cn.stronglink.assetmanage.business.task.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import cn.stronglink.assetmanage.business.check.view.checked.CheckedListFragment;
import cn.stronglink.assetmanage.business.check.view.sync.CheckSyncListFragment;
import cn.stronglink.assetmanage.business.check.view.wait.WaitListFragment;
import cn.stronglink.assetmanage.business.task.view.operate.TaskOperateFragment;
import cn.stronglink.assetmanage.business.task.view.sync.TaskSyncFragment;
import cn.stronglink.assetmanage.business.task.view.wait.TaskWaitFragment;

/**
 * Created by chencongcong on 2018/6/13.
 */

public class TaskVpAdapter extends FragmentPagerAdapter {
    private String[] pageTitleArr;
    public TaskVpAdapter(FragmentManager fm, String[] pageTitleArr) {
        super(fm);
        this.pageTitleArr = pageTitleArr;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return pageTitleArr[position];
    }

    @Override
    public Fragment getItem(int position) {
        //创建fragment并返回
        Fragment fragment=null;
        switch (position){
            case 0:
                fragment = new TaskWaitFragment();
                break;
            case 1:
                fragment = new TaskOperateFragment();
                break;
            case 2:
                fragment = new TaskSyncFragment();
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return pageTitleArr == null ? 0 : pageTitleArr.length;
    }


}
